$(function(){
	var admin_id = getCookie('admin_id');
	if(!admin_id){
		window.location.replace('login.html');
	}
	var elem = document.querySelector('.js-switch');
    var switchery = new Switchery(elem, {
        color: '#1AB394'
    });
    //业务开始
    var uid = getQueryString('id');
    if(!uid){
    	swal("操作错误", "参数传递错误！", "error");
    	setTimeout(function(){
             location.href="recharge.html";
		},3000);
		return false;
    }else{
    	document.getElementById("uid").value=uid;
    }
	//提交表单
   $("#submit").click(function(){
   		 if($("#signupForm").valid()){
          var query = $("#signupForm").serialize();
          ajax_post(ApiUrl + "/member/recharge","member_list.html",query);
    	}
   });
   var icon = "<i class='fa fa-times-circle'></i> ";
     $("#signupForm").validate({
        rules: {
            money: {
                required: true,
                number : true
            },
            memo: {
                required: true
            }
        },
        messages: {
            money: {
                required: icon+ "请输入会员名称！",
                 number :  icon+"充值金额只能是数字！" 
            },
            phone: {
                required: icon+ "请输入操作备注！"
            }
        }
    });
});